﻿# Tags:
# rank_headgear: any headgear that signifies a certain title. crowns, pope hat etc.

headgear_base = {

	usage = game
	selection_behavior = weighted_random
	priority = 1

	# Shogunate

	shogunate_no_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			# No headgear for Japanese characters
			modifier = {
				add = 100
				portrait_japanese_clothing_trigger = yes
			}
		}
	}
	
	shogunate_japanese_suieikan = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = shogunate_suieikan
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 150
				AND = {
					OR = {
						AND = {
							highest_held_title_tier >= tier_kingdom
							OR = {
								government_has_flag = government_is_feudal
								government_has_flag = government_is_administrative
							}
						}
						AND = {
							exists = court_owner
							court_owner = {
								highest_held_title_tier >= tier_kingdom
								culture = { has_cultural_pillar = heritage_imperial_court }
							}
						}
						AND = {
							culture = { has_cultural_pillar = heritage_imperial_court }
							is_landed = yes
						}
					}
	                NOT = { portrait_wear_armor_trigger = yes }
					portrait_yamato_clothing_trigger = yes
					scope:age >= 16
				}
			}
			modifier = {
				add = 150
				AND = {
					shogunate_before_sengoku_period_trigger = yes
					shogunate_should_be_no_hair_trigger = no
					portrait_yamato_clothing_trigger = yes
					scope:age >= 16
				}
			}
		}
	}

## SP4 Crowns of the World ##

	sp4_mena_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp4_mena_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 30
				has_sp4_dlc_trigger = yes
				portrait_royalty_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = 60
				has_sp4_dlc_trigger = yes
				portrait_royalty_trigger = {
					CULTURE_INPUT = turkic
				}
			}
			modifier = {
				factor = 0 # Should NOT show up if we're not in the right era
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
			}
		}
	}

	sp4_rus_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp4_rus_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				has_sp4_dlc_trigger = yes
				portrait_royalty_trigger = {
					CULTURE_INPUT = rus
				}
			}
			modifier = {
				add = -50
				has_pol_dlc_trigger = yes
				portrait_royalty_trigger = {
					CULTURE_INPUT = west_slavic
				}
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	sp4_western_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp4_western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				has_sp4_dlc_trigger = yes
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0 # Should NOT show up if we're not in the right era
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
			}
		}
	}

## SP3 ##

	sp3_western_royalty_era3 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp3_western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				has_dlc_feature = couture_of_the_capets
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				portrait_royalty_trigger = {
					CULTURE_INPUT = french
				}
			}
			modifier = {
				add = 90
				has_dlc_feature = couture_of_the_capets
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0 # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
				NAND = {
					portrait_era1_trigger = no
					portrait_royalty_trigger = {
						CULTURE_INPUT = french
					}
				}
			}
		}
	}

	sp3_western_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp3_western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				is_female = no
				has_dlc_feature = couture_of_the_capets
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
				NAND = {
					portrait_era1_trigger = no
					portrait_royalty_trigger = {
						CULTURE_INPUT = french
					}
				}
			}
		}
	}

	sp3_western_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp3_western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				is_female = yes
				has_dlc_feature = couture_of_the_capets
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

## SP2 ##

	sp2_western_imperial_era1 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp2_western_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 90
				has_dlc_feature = elegance_of_the_empire
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = western
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
			}
			modifier = {
				add = 90
				has_dlc_feature = elegance_of_the_empire
				OR = {
					portrait_royalty_trigger = {
						CULTURE_INPUT = western
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = western
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = ugro_permian
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				is_female = yes
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOT = {
					portrait_era1_trigger = yes
				}
			}
		}
	}

	sp2_western_imperial_era2 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp2_western_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 90
				has_dlc_feature = elegance_of_the_empire
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = western
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
			}
			modifier = {
				add = 90
				has_dlc_feature = elegance_of_the_empire
				OR = {
					portrait_royalty_trigger = {
						CULTURE_INPUT = western
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = western
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				is_female = yes
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOT = {
					portrait_era2_trigger = yes
				}
			}
		}
	}

	sp2_western_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sp2_western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				has_dlc_feature = elegance_of_the_empire
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
				}
			}
		}
	}


## DDE HRE ##

	dde_hre_commoners = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_hre_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = dde_hre # CULTURE_INPUT gets added into the trigger referenced in 00_clothing_triggers.txt so it's important the input is a correct match to an existing culture trigger
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	dde_hre_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_hre_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = dde_hre } # common/scripted_modifiers/00_portrait_modifiers.txt
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = dde_hre
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	dde_hre_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_hre_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era3_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = dde_hre
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	dde_hre_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_hre_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era3_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = dde_hre
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	# Reichskrone
	dde_hre_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_hre_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
#			modifier = {
#				add = 100 # always pick the HRE crown over the western one
#				portrait_reichskrone_trigger = yes
#			}
		}
	}

## Western ##

	western_commoners = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
		}
	}

	ep2_western_era1_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era1_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep2_western_era2_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
		}
	}

	ep2_western_era3_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era3_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era3_trigger = yes
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era3_trigger = yes
			}
		}
	}

	fp4_western_era3_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp4_western_era3_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = western
				}
				portrait_era3_trigger = yes
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = western
				}
				portrait_era3_trigger = yes
			}
		}
	}

	western_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
		}
	}

	ep2_western_era1_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era1_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep2_western_era2_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
		}
	}

	ep2_western_era3_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era3_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era3_trigger = yes
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	fp4_western_era3_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp4_western_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ce1_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = western
				}
				has_ce1_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	western_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
		}
	}

	ep2_western_era1_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era1_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep2_western_era2_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
		}
	}

	ep2_western_era3_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era3_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	western_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
		}
	}

	ep1_western_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0
				NOT = {
					has_ep1_dlc_trigger = yes
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOT = {
					portrait_era2_trigger = yes
				}
			}
		}
	}

	ep1_western_era1_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
			}
			modifier = {
				factor = 0
				NOT = {
					has_ep1_dlc_trigger = yes
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				NOT = {
					portrait_era1_trigger = yes
				}
			}
		}
	}

	ep2_western_era1_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era1_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep2_western_era2_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
			modifier = {
				factor = 0
				has_ce1_dlc_trigger = yes
			}
		}
	}

	ep2_western_era3_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_era3_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era3_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	ep1_italian_royalty = { # The Iron Crown of Lombardy
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_italian_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				culture = {
					has_cultural_pillar = heritage_latin
				}
				has_ep1_dlc_trigger = yes
			}
		}
	}

	fp4_western_era2_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp4_western_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = western
				}
				has_ce1_dlc_trigger = yes
				portrait_era2_trigger = yes
			}
		}
	}

	western_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = western
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				NOT = { has_ep2_dlc_trigger = yes }
			}
		}
	}

	ep2_western_era1_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep2_western_era1_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era1_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep2_western_era2_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era2_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
				}
			}
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
				}
			}
		}
	}

	ep2_western_era4_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = ep2_western_era3_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = western
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era4_trigger = yes
				}
			}
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era4_trigger = yes
				}
			}
		}
	}

	#RTT headgear
	monarchs_journey_late_unlock = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = monarchs_journey_unleashed
				range = { 0 1 } # For the randomness to work correctly
			}
		}

		weight = {
			base = 0
			modifier = {
				add = 10
				current_date >= 1300.1.1
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_western_clothing_spouse_trigger = yes
				}
				OR = {
					AND = {
						is_lowborn = no
						is_female = yes
					}
					AND = {
						government_has_flag = government_is_republic
						highest_held_title_tier <= tier_barony
					}
				}
				trigger_if = {
					limit = {
						is_ruler = yes
					}
					primary_title.tier <= tier_duchy
				}
			}
			modifier = {
				add = 30
				portrait_era4_trigger = yes
				portrait_low_nobles_trigger = {
					CULTURE_INPUT = western
				}
			}
		}
	}

## Byzantine ##

	byzantine_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
			}
		}
	}

	ep3_byzantine_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era1_commoner
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
			}
		}
	}

	byzantine_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = byzantine }
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era1_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era1_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era1_bare_headed_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
				OR = {
					portrait_low_nobles_clothing_trigger = {
						CULTURE_INPUT = byzantine
					}
					portrait_high_nobles_clothing_trigger = {
						CULTURE_INPUT = byzantine
					}
				}
				NOR = {
					portrait_royalty_trigger = {
						CULTURE_INPUT = byzantine
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = byzantine
					}
				}
			}
			modifier = {
				add = 80
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
		}
	}

	ep3_byzantine_era2_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era2_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				court_fashion_level_4_headgear_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	byzantine_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era1_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era1_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 10
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era2_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era2_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	byzantine_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era1_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era1_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_royalty_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era2_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era2_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_royalty_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	byzantine_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
			}
		}
	}

	ep1_byzantine_imperial = { # Crown of Justinian
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_byzantine_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = byzantine
				}
			}
			modifier = {
				factor = 0
				NOT = {
					has_title = title:e_byzantium
				}
			}
			modifier = {
				factor = 0
				NOT = {
					has_ep1_dlc_trigger = yes
				}
			}
			modifier = {
				factor = 0
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	ep3_byzantine_era1_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era1_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_imperial_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	ep3_byzantine_era2_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep3_byzantine_era2_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_imperial_trigger = {
					CULTURE_INPUT = byzantine
				}
				has_ep3_dlc_trigger = yes
				OR = {
					portrait_era2_trigger = yes
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

## INDIAN ##

	indian_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = indian_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = indian
				}
			}
			modifier = { # Non-european jesters should not use the jester hat
				add = 1000
				portrait_jester_trigger = {
					CULTURE_INPUT = indian
				}
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = indian
				}
			}
		}
	}

	indian_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = indian_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = indian }
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = indian
				}
			}
		}
	}

	indian_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = indian_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = indian
				}
			}
		}
	}

	indian_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = indian_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = indian
				}
			}
		}
	}

	ep1_indian_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_indian_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_royalty_trigger = {
					CULTURE_INPUT = indian
				}
				culture = {
					has_cultural_pillar = heritage_burman
				}
				has_ep1_dlc_trigger = yes
			}
		}
	}

	indian_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = indian_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_trigger = {
					CULTURE_INPUT = indian
				}
			}
		}
	}

	ep1_indian_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_indian_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_imperial_trigger = {
					CULTURE_INPUT = indian
				}
				culture = {
					has_cultural_pillar = heritage_burman
				}
				has_ep1_dlc_trigger = yes
			}
		}
	}

## MENA ##

	mena_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = { # Non-european jesters should not use the jester hat
				add = 1000
				portrait_jester_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = -36 # Slightly lower if north african is valid
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	mena_mayors = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 60
				portrait_mayor_headgear_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = -36 # Slightly lower if north african is valid
				portrait_mayor_headgear_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	mena_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = mena }
			modifier = {
				add = {
					value = 50
					if = {
						limit = {
							OR = {
								portrait_low_nobles_clothing_trigger = {
									CULTURE_INPUT = fp3_iranian
								}
								portrait_low_nobles_clothing_trigger = {
									CULTURE_INPUT = afr_berber
								}
							}
						}
						add = -36 # Slightly lower if iranian or north african is valid
					}
				}
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = mena
				}
			}
		}
	}

	mena_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = -36 # Slightly lower if iranian or north african is valid
				OR = {
					portrait_high_nobles_headgear_trigger = {
						CULTURE_INPUT = fp3_iranian
					}
					portrait_high_nobles_headgear_trigger = {
						CULTURE_INPUT = afr_berber
					}
				}
			}
		}
	}

	mena_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = -36 # Slightly lower if iranian or north african is valid
				OR = {
					portrait_royalty_trigger = {
						CULTURE_INPUT = fp3_iranian
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = afr_berber
					}
				}
			}
		}
	}

	ep1_mena_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_mena_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_royalty_trigger = {
					CULTURE_INPUT = mena
				}
				culture = {
					has_cultural_pillar = heritage_east_african
				}
				religion = religion:islam_religion
				has_ep1_dlc_trigger = yes
			}
		}
	}

	mena_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_nobles_headgear_trigger = {
					CULTURE_INPUT = mena
				}
			}
			modifier = {
				add = -36 # Slightly lower if iranian or north african is valid
				OR = {
					portrait_imperial_nobles_headgear_trigger = {
						CULTURE_INPUT = fp3_iranian
					}
					portrait_imperial_nobles_headgear_trigger = {
						CULTURE_INPUT = afr_berber
					}
				}
			}
		}
	}

	ep1_persian_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_persian_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_nobles_headgear_trigger = {
					CULTURE_INPUT = mena
				}
				culture = {
					has_cultural_pillar = heritage_iranian
				}
				has_ep1_dlc_trigger = yes
			}
		}
	}

## DDE ABBASID ##

	dde_abbasid_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_abbasid_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = dde_abbasid
				}
			}
			modifier = {
				add = -36 # Slightly lower if north african is valid
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	dde_abbasid_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_abbasid_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = dde_abbasid
				}
			}
			modifier = {
				add = -36 # Slightly lower if iranian or north african is valid
				OR = {
					portrait_high_nobles_headgear_trigger = {
						CULTURE_INPUT = fp3_iranian
					}
					portrait_high_nobles_headgear_trigger = {
						CULTURE_INPUT = afr_berber
					}
				}
			}
		}
	}

	dde_abbasid_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_abbasid_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_trigger = {
					CULTURE_INPUT = dde_abbasid
				}
			}
			modifier = {
				add = -36 # Slightly lower if north african is valid
				portrait_royalty_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
			#modifier = {
			#	add = -36 # Slightly lower if iranian is valid
			#	portrait_royalty_trigger = {
			#		CULTURE_INPUT = fp3_iranian
			#	}
			#}
		}
	}

	dde_abbasid_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = dde_abbasid_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100 # pick over mena
				portrait_imperial_trigger = {
					CULTURE_INPUT = dde_abbasid
				}
			}
			modifier = {
				add = -56 # Slightly lower if iranian or north african is valid
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = fp3_iranian
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = afr_berber
					}
				}
			}
		}
	}

## Steppe ##

	steppe_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = steppe_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = steppe
				}
			}
			modifier = { # Non-european jesters should not use the jester hat
				add = 1000
				portrait_jester_trigger = {
					CULTURE_INPUT = steppe
				}
				NOR = {
					portrait_western_clothing_trigger = yes
					portrait_byzantine_clothing_trigger = yes
					portrait_northern_clothing_trigger = yes
				}
			}
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = steppe
				}
			}
		}
	}

	mpo_mongol_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mpo_mongol_commoner
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 20
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = steppe
				}
				has_mpo_dlc_trigger = yes
			}
		}
	}

	steppe_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = steppe_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = steppe }
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = steppe
				}
			}
		}
	}

	mpo_mongol_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mpo_mongol_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = steppe }
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = steppe
				}
				has_mpo_dlc_trigger = yes
			}
			modifier = {
				add = -50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = fp3_turkic
				}
			}
		}
	}

	steppe_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = steppe_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = steppe
				}
			}
		}
	}

	steppe_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = steppe_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = steppe
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = steppe
					}
				}
			}
			modifier = {
				add = -10
				has_mpo_dlc_trigger = yes
			}
		}
	}

	ep1_steppe_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_steppe_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				OR = {
					portrait_imperial_trigger = {
						CULTURE_INPUT = steppe
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = steppe
					}
				}
			}
			modifier = {
				factor = 0
				NOR = {
					has_ep1_dlc_trigger = yes
					has_mpo_dlc_trigger = yes
				}
			}
		}
	}

	mpo_mongol_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mpo_mongol_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_royalty_trigger = {
					CULTURE_INPUT = steppe
				}
				has_mpo_dlc_trigger = yes
			}
		}
	}

	mpo_mongol_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mpo_mongol_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 85
				portrait_imperial_trigger = {
					CULTURE_INPUT = steppe
				}
				has_mpo_dlc_trigger = yes
			}
			modifier = {
				add = -85
				portrait_imperial_trigger = {
					CULTURE_INPUT = fp3_turkic
				}
				has_mpo_dlc_trigger = yes
			}
		}
	}



## Northern Pagans ##

	northern_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = northern_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 70
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = northern
				}
			}
			modifier = {
				add = 30
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = northern
				}
			}
		}
	}

	northern_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = northern_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = northern }
			modifier = {
				add = 50
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = northern
				}
			}
		}
	}

	northern_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = northern_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = northern
				}
			}
		}
	}

	northern_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = northern_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				OR = {
					portrait_royalty_trigger = {
						CULTURE_INPUT = northern
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = sami
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = ugro_permian
					}
				}
			}
		}
	}

## AFR ##

	afr_berber_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = afr_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
			modifier = {
				add = 21
				portrait_commoner_no_mayors_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	afr_berber_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = afr_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = afr_berber }
			modifier = {
				add = 51
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	afr_berber_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = afr_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	afr_berber_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = afr_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51
				portrait_royalty_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

	afr_berber_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = afr_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51
				portrait_imperial_nobles_headgear_trigger = {
					CULTURE_INPUT = afr_berber
				}
			}
		}
	}

## POL ##

	pol_west_slavic_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = pol_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 90
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
			modifier = {
				add = 30
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
		}
	}

	pol_west_slavic_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = pol_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = west_slavic }
			modifier = {
				add = 80
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
		}
	}

	pol_west_slavic_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = pol_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
		}
	}

	pol_west_slavic_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = pol_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_royalty_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
			modifier = {
				factor = 0
				has_sp4_dlc_trigger = yes
				OR = {
					portrait_era1_trigger = yes
					portrait_era2_trigger = yes
				}
			}
		}
	}

	pol_west_slavic_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = pol_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = { # Can be combined with veils
				mode = add
				gene = additive_headgear
				template = western_veils
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_imperial_trigger = {
					CULTURE_INPUT = west_slavic
				}
			}
		}
	}

## CCP4 Sami ##

ccp4_sami_commoners = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_sami_common
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 90
			portrait_commoner_headgear_fallback_trigger = {
				CULTURE_INPUT = sami
			}
		}
		modifier = {
			add = 30
			portrait_commoner_clothing_trigger = {
				CULTURE_INPUT = sami
			}
		}
	}
}

ccp4_sami_low_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_sami_low_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = sami }
		modifier = {
			add = 80
			portrait_low_nobles_clothing_trigger = {
				CULTURE_INPUT = sami
			}
		}
	}
}

ccp4_sami_high_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_sami_high_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 80
			portrait_high_nobles_headgear_trigger = {
				CULTURE_INPUT = sami
			}
		}
	}
}

## CCP4 Khanty ##

ccp4_ugro_permian_commoners = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_khanty_common
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 90
			portrait_commoner_headgear_fallback_trigger = {
				CULTURE_INPUT = ugro_permian
			}
		}
		modifier = {
			add = 30
			portrait_commoner_clothing_trigger = {
				CULTURE_INPUT = ugro_permian
			}
		}
	}
}

ccp4_ugro_permian_low_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_khanty_low_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = ugro_permian }
		modifier = {
			add = 80
			portrait_low_nobles_clothing_trigger = {
				CULTURE_INPUT = ugro_permian
			}
		}
	}
}

ccp4_ugro_permian_high_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = ccp4_khanty_high_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 80
			portrait_high_nobles_headgear_trigger = {
				CULTURE_INPUT = ugro_permian
			}
		}
	}
}

## FP3 Iranian ##

fp3_iranian_low_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_iranian_low_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = fp3_iranian }
		modifier = {
			add = 51 # Slightly higher
			portrait_low_nobles_clothing_trigger = {
				CULTURE_INPUT = fp3_iranian
			}
		}
	}
}

fp3_iranian_high_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_iranian_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 51 # Slightly higher
			portrait_high_nobles_headgear_trigger = {
				CULTURE_INPUT = fp3_iranian
			}
		}
	}
}

fp3_iranian_royalty = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_iranian_royalty
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 51 # Slightly higher
			OR = {
				portrait_royalty_trigger = {
					CULTURE_INPUT = fp3_iranian
				}
				portrait_royalty_trigger = {
					CULTURE_INPUT = fp3_turkic
				}
			}
		}
	}
}

fp3_iranian_imperial = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_iranian_imperial
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 51 # Slightly higher
			OR = {
				portrait_imperial_trigger = {
					CULTURE_INPUT = fp3_iranian
				}
				portrait_imperial_trigger = {
					CULTURE_INPUT = fp3_turkic
				}
			}
		}
	}
}

## FP3 Turkic ##

fp3_turkic_low_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_turkic_low_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = fp3_turkic }
		modifier = {
			add = 51 # Slightly higher
			portrait_low_nobles_clothing_trigger = {
				CULTURE_INPUT = fp3_turkic
			}
		}
	}
}

fp3_turkic_high_nobles = {
	dna_modifiers = {
		accessory = {
			mode = add
			gene = headgear
			template = fp3_turkic_nobility
			range = { 0 1 } # For the randomness to work correctly
		}
	}
	weight = {
		base = 0
		modifier = {
			add = 51 # Slightly higher
			portrait_high_nobles_headgear_trigger = {
				CULTURE_INPUT = fp3_turkic
			}
		}
	}
}

## FP2 Iberian ##
	fp2_iberian_muslim_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_muslim_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = fp2_iberian_muslim
				}
			}
			modifier = {
				add = 41 # Slightly higher
				portrait_commoner_no_mayors_trigger = {
					CULTURE_INPUT = fp2_iberian_muslim
				}
			}
		}
	}

	fp2_iberian_muslim_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_muslim_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = fp2_iberian_muslim }
			modifier = {
				add = 51 # Slightly higher
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = fp2_iberian_muslim
				}
			}
		}
	}

	fp2_iberian_muslim_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_muslim_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51 # Slightly higher
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = fp2_iberian_muslim
				}
			}
		}
	}

	fp2_iberian_muslim_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_muslim_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51 # Slightly higher
				portrait_royalty_trigger = {
					CULTURE_INPUT = fp2_iberian_muslim
				}
			}
		}
	}

	fp2_iberian_christian_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_christian_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { iberian_christian_shrimp_wrap }
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = fp2_iberian_christian
				}
			}
			modifier = {
				add = 41 # Slightly higher
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = fp2_iberian_christian
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	fp2_iberian_christian_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_christian_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = fp2_iberian_christian }
			modifier = {
				add = 60 # Slightly higher
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = fp2_iberian_christian
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	fp2_iberian_christian_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_christian_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 60 # Slightly higher
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = fp2_iberian_christian
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

	fp2_iberian_christian_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp2_christian_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51 # Slightly higher
				portrait_royalty_trigger = {
					CULTURE_INPUT = fp2_iberian_christian
				}
			}
			modifier = {
				factor = 0	   # Should NOT show up if EP2 is active and we're not in the right era
				has_ep2_dlc_trigger = yes
				portrait_era1_trigger = yes
			}
		}
	}

## FP1 NORSE ##

	fp1_norse_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp1_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = fp1_norse
				}
			}
			modifier = {
				add = 41 # Slightly higher
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = fp1_norse
				}
			}
		}
	}

	fp1_norse_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp1_low_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			court_fashion_level_4_headgear_modifier = { INPUT_PARAMETER = fp1_norse }
			modifier = {
				add = 51 # Slightly higher
				portrait_low_nobles_clothing_trigger = {
					CULTURE_INPUT = fp1_norse
				}
			}
		}
	}

	fp1_norse_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp1_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51 # Slightly higher
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = fp1_norse
				}
			}
		}
	}

	fp1_norse_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp1_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 51 # Slightly higher
				OR = {
					AND = {
						has_dlc_feature = the_northern_lords
						portrait_royalty_trigger = {
							CULTURE_INPUT = northern
						}
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = fp1_norse
					}
				}
			}
		}
	}

	fp1_norse_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = fp1_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100 # pick over northern
				OR = {
					AND = {
						has_dlc_feature = the_northern_lords
						portrait_imperial_trigger = {
							CULTURE_INPUT = northern
						}
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = fp1_norse
					}
				}
			}
		}
	}

## Sub-Saharan Africans ##

	african_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sub_saharan_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_commoner_headgear_fallback_trigger = {
					CULTURE_INPUT = african
				}
			}
			modifier = { # Non-european jesters should not use the jester hat
				add = 1000
				portrait_jester_trigger = {
					CULTURE_INPUT = african
				}
			}
			modifier = {
				add = 50
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = african
				}
			}
		}
	}

	sub_saharan_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sub_saharan_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_high_nobles_headgear_trigger = {
					CULTURE_INPUT = african
				}
			}
		}
	}

	sub_saharan_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sub_saharan_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_african_headgear_trigger = yes
			}
		}
	}

	ep1_sub_saharan_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = ep1_sub_saharan_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_royalty_african_headgear_trigger = yes
			}
			modifier = {
				factor = 0
				NOT = {
					has_ep1_dlc_trigger = yes
				}
			}
		}
	}

	sub_saharan_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = sub_saharan_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_imperial_nobles_headgear_trigger = {
					CULTURE_INPUT = african
				}
			}
		}
	}


	sub_saharan_war = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_war
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { military_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_war_nobles_helmet_trigger = {
					CULTURE_INPUT = african
				}
			}
		}
	}




######## Religious ##########


## Orthodox ##

	religious_orthodox_high = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_orthodox_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit bishop_outfit }
		weight = {
			base = 0
			modifier = {
				add = 130
				portrait_religious_orthodox_trigger = yes
				portrait_religious_high_headgear_trigger = {
					FAITH_INPUT = orthodox
				}
			}
		}
	}

	religious_orthodox_head = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_orthodox_head
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 200
				portrait_religious_head_trigger = yes
				faith = faith:orthodox
			}
		}
	}


## Catholic ##

	catholic_devoted = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_catholic_devoted
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { monk_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_religious_devoted_trigger = yes
				portrait_religious_christian_trigger = yes
			}
		}
	}

	catholic_head = {
		outfit_tags = { rank_headgear }
		usage = game
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = catholic_head
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 120
				portrait_religious_head_trigger = yes
				portrait_religious_catholic_trigger = yes
			}
		}
	}

	catholic_high = {
		outfit_tags = { rank_headgear }
		usage = game
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = catholic_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit bishop_outfit }
		weight = {
			base = 0
			modifier = {
				add = 120
				portrait_religious_christian_trigger = yes
				portrait_religious_high_trigger = yes
			}
		}
	}

	popes = {
		outfit_tags = { rank_headgear }
		usage = game
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = catholic_head
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 140
				portrait_religious_head_popes_trigger = yes
			}
		}
	}

## Jewish ##

	religious_jewish_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_jewish_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_religious_high_no_poverty_trigger = yes
				OR = {
					portrait_religious_jewish_trigger = yes
					portrait_religious_hellenism_trigger = yes
				}
			}
		}
	}

	religious_jewish_head = {
		outfit_tags = { rank_headgear }
		usage = game
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = religious_jewish_head
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 140
				portrait_religious_head_no_poverty_trigger = yes
				portrait_religious_jewish_trigger = yes
			}
		}
	}

## Muslim ##

	religious_muslim_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_muslim_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 111
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_muslim_trigger = yes
			}
		}
	}



## Northern Pagan ##

	religious_northern_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_northern_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_norse_trigger = yes
			}
		}
	}


## Steppe ##

	religious_steppe_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_steppe_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_steppe_trigger = yes
			}
			modifier = {
				add = 100
				has_court_position = court_astrologer_court_position
				exists = situation:the_great_steppe
				liege ?= {
					any_character_situation = {
						this = situation:the_great_steppe
					}
				}
			}
		}
	}

## Buddhist ##

	religious_buddhist_devoted_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = {
				mode = add
				gene = hairstyles
				template = no_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { monk_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_has_trait_trigger = { TRAIT = devoted }
				portrait_religious_buddhist_trigger = yes
			}
		}
	}

	religious_buddhist_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = {
				mode = add
				gene = hairstyles
				template = no_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 110
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_buddhist_trigger = yes
			}
		}
	}

## Hinduist ##

	religious_hindu_devoted_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { monk_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_has_trait_trigger = { TRAIT = devoted }
				portrait_religious_hindu_trigger = yes
			}
		}
	}

	religious_hindu_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 110
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_hindu_trigger = yes
			}
		}
	}

## Zoroastrian ##

	religious_zoroastrian_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_zoroastrian_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_zoroastrian_trigger = yes
			}
		}
	}

## Jain ##

	religious_jain_devoted_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { monk_outfit }
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_has_trait_trigger = { TRAIT = devoted }
				portrait_religious_jain_trigger = yes
			}
		}
	}

	religious_jain_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 110
				exists = this
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_jain_trigger = yes
			}
		}
	}

## African Pagan ##

	# religious_african_devoted_clothes = {
	# 	dna_modifiers = {
	# 		accessory = {
	# 			mode = add
	# 			gene = clothes
	# 			template = mena_commoner_clothes
	# 			range = { 0 1 } # For the randomness to work correctly
	# 		}
	# 	}
	#	outfit_tags = { monk_outfit }
	# 	weight = {
	# 		base = 0
	# 		modifier = {
	# 			add = 100
	# 			portrait_has_trait_trigger = { TRAIT = devoted }
	# 			religion = religion:islam_religion
	# 		}
	# 	}
	# }

	religious_african_high_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = religious_african_high
				range = { 0 1 }
			}
		}
		outfit_tags = { priest_outfit }
		weight = {
			base = 0
			modifier = {
				add = 110
				portrait_religious_high_no_poverty_trigger = yes
				portrait_religious_african_trigger = yes
			}
		}
	}

	jester_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = ep1_jester
				range = { 0 1 }
			}
		}
		outfit_tags = { jester_outfit }
		weight = {
			base = -100
			modifier = {
				add = 1000
				OR = {
					portrait_jester_trigger = { CULTURE_INPUT = western }
					portrait_jester_trigger = { CULTURE_INPUT = byzantine }
					portrait_jester_trigger = { CULTURE_INPUT = northern }
				}
			}
			modifier = {
				factor = 0
				OR = {
					is_adult = no
					should_be_naked_trigger = yes
				}
			}
		}
	}

	master_assassin_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = mena_stealth
				range = { 0 1 }
			}
		}
		weight = {
			base = -100
			modifier = {
				add = 1000
				has_court_position = master_assassin_court_position
			}
			modifier = {
				factor = 0
				OR = {
					is_adult = no
					should_be_naked_trigger = yes
				}
			}
		}
	}

	#RTT headgear
	monarchs_journey_late_unlock = {
		dna_modifiers = {
			accessory = {
				mode = add

				gene = headgear
				template = monarchs_journey_unleashed
				range = { 0 1 } # For the randomness to work correctly
			}
		}

		weight = {
			base = -100
			modifier = {
				add = 110
				current_date >= 1300.1.1
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_western_clothing_spouse_trigger = yes
				}
				OR = {
					AND = {
						is_lowborn = no
						is_female = yes
					}
					AND = {
						government_has_flag = government_is_republic
						highest_held_title_tier <= tier_barony
					}
				}
			}
		}
	}

	hajj_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 500
				exists = this
				OR = {
					portrait_ep2_hajj_clothes_trigger = yes
					portrait_ep2_ihram_clothes_trigger = yes
				}
			}
		}
	}

	# EP2 - WEDDINGS

	wedding_western_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = western_wedding
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { spouse_outfit }
		weight = {
			base = 0
			modifier = {
				add = 1000
				has_ep2_dlc_trigger = yes
				portrait_ep2_wedding_clothes_trigger = yes
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_northern_clothing_trigger = yes
				}
			}
		}
	}

	wedding_mena_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = mena_wedding
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { spouse_outfit }
		weight = {
			base = 0
			modifier = {
				add = 1000
				has_ep2_dlc_trigger = yes
				portrait_ep2_wedding_clothes_trigger = yes
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
					portrait_indian_clothing_trigger = yes
					portrait_steppe_clothing_trigger = yes
				}
			}
		}
	}

	wedding_byz_headgear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = byzantine_wedding
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		outfit_tags = { spouse_outfit }
		weight = {
			base = 0
			modifier = {
				add = 1000
				has_ep2_dlc_trigger = yes
				portrait_ep2_wedding_clothes_trigger = yes
				portrait_byzantine_clothing_trigger = yes
			}
		}
	}
}
